﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Medianamik.Core.DAL.SQL
{
    public class NullColumnPredicate : IPredicate , ISqlQueryPart 
    {
        public NullColumnPredicate(Column pColumn)
        {
            Subject = pColumn.NameWithAlias;
        }

        #region IPredicate Members

        public string Subject
        {
            get; private set;
        }

        public string Operator
        {
            get { return " IS "; }
        }

        public IExpression Expression
        {
            get { return NullExpression.Value; }
        }

        #endregion

        #region ISqlQueryPart Members

        public StringBuilder ToSQL()
        {
            return new StringBuilder()
                .Append(Subject)
                .Append(Operator)
                .Append(Expression.ToSQL());
        }

        #endregion
    }
}
